﻿import QtQuick 2.0
import "../components"

// 故障

Rectangle {

    id: root
    radius: 8*dp

    height: Math.max(60*dp, width*0.2)
    width: 210*dp

    signal clicked()

    visible: gExpIsFailure > 0

    color: Qt.rgba(1, 1, 1, 0.6)

    Row{
        anchors.centerIn: parent
        spacing: 10*dp
        CustomImage{
            height: 16*dp; width: 16*dp
            anchors.verticalCenter: parent.verticalCenter
            source: "qrc:/picture/msgWarning.png"
        }
        Text{
            text: "实验故障"
            font.pixelSize: config.fontsize_1
        }
    }

    MouseArea{
        anchors.fill: parent
        hoverEnabled: true
        onEntered: {
            toolTip.visible = true
        }onExited: {
            toolTip.visible = false
        }onClicked: {
            root.clicked()
        }
    }

    CustomTooltip{
        id: toolTip
        visible: false
        text: {
            if(gExpIsFailurePause === 1)     return "实验已暂停，请前往故障页面进行处理"
            if(gExpIsFailure === 1)          return "实验流程故障未处理，请前往故障页面进行处理"
            if(gExpIsFailure === 2)          return "实验并发故障未处理，请前往故障页面进行处理"
            else                             return "请前往故障页面进行处理"
        }
    }

}
